const os = require('os');

function getMacAddress(){
 let macAddress;

// 获取所有网络接口的信息
const networkInterfaces = os.networkInterfaces();

// 遍历所有网络接口寻找第一个有效的MAC地址
for (const interfaceName in networkInterfaces) {
  const aliases = networkInterfaces[interfaceName];
  for (let i = 0; i < aliases.length; i++) {
    if (aliases[i].mac && aliases[i].mac !== '00:00:00:00:00:00') {
      macAddress = aliases[i].mac;
      break;
    }
  }
  if (macAddress) break;
}

    return macAddress

}


export {
    getMacAddress
}




